{extend name="A_public:index"/}
<title>{block name="title"}用户修改{/block}</title>
{block name="allinfo"}
<div class="content-panel">
      <h4><i class="fa fa-angle-right"></i> 您正在修改<font size="30px" color='red'>{$userinfo[0]['username']}</font>的资料</h4><hr><table class="table table-striped table-advance table-hover" style="margin-bottom: 0px">        
      </table>
      <div class="form-panel">
          <form action='/user/update' class="form-horizontal style-form" method="post" id="ss">
              <div class="form-group">
                  <label class="col-sm-2 col-sm-2 control-label">用户名:</label>
                  <div class="col-sm-10">
                      <input type="text" name="username" class="form-control" value="{$userinfo[0]['username']}" onfocus=this.blur() title="用户名">
                  </div>
              </div>         
              <div class="form-group">
                  <label class="col-sm-2 col-sm-2 control-label">邮箱:</label>
                  <div class="col-sm-10">
                      <input type="text" name="email" class="form-control" value="{$userinfo[0]['email']}">
                  </div>
              </div>
              <div class="form-group">
                  <label class="col-sm-2 col-sm-2 control-label">密码:</label>
                  <div class="col-sm-10">
                      <input type="password" name="pass" class="form-control" placeholder="请输入新密码">
                  </div>
              </div>
              <div class="form-group">
                  <label class="col-sm-2 col-sm-2 control-label">确认密码:</label>
                  <div class="col-sm-10">
                      <input type="password" name="repass" class="form-control" placeholder="重新输入一次">
                  </div>
              </div>
              <input type="hidden" name="id" value="{$userinfo[0]['id']}">
               <div class="form-group">
                  <label class="col-sm-2 col-sm-2 control-label">登录状态:</label>
                  <div class="col-sm-10" style="width: 230px">
                      <select name="status" id="sss" class="form-control" >
                        {if condition="($userinfo[0]['status'] == 1)"}
                        	<option value="1" selected>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;启用用户</option>
                         	 <option value="0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;禁止登录</option>
						{else /}
							<option value="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;启用用户</option>
                          <option value="0" selected>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;禁止登录</option>
						{/if}
                          
                      </select>
                  </div>
              </div>

              <div class="form-group">
                  <label class="col-lg-2 col-sm-2 control-label"></label>
                  <div class="col-lg-10">
                      <input type="submit" class="btn btn-success"  value="提交">
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                      <input type="reset" class="btn btn-success" value="重置">
                  </div>
              </div>
          </form>
      </div>
  </div>

<script src="/assets/js/jquery-1.8.3.min.js"></script>

<script>
	//验证邮箱

	$('#ss').submit(function(){
		email = $('input[name="email"]').val();
		pass = $('input[name="pass"]').val();
		repass = $('input[name="repass"]').val();
	
		//验证邮箱
		if(email.match(/^\w+@\w+(\.\w+)$/)==null){
			alert('邮箱不符合规则');
			return false;
		}else{

			//验证密码
			if(pass.match(/^\w{6,16}$/)==null){
				alert('密码必须是4-8位的任意的数字字母下划线');
				return false;
			}else{
				if (pass!=repass) {
					alert('两次密码不同');
					return false;
				}else{
					return true;
				}
			}
		}

	})


</script>

{/block}

